module.exports = () => {
    return async (ctx,next) => {
        let writePath = ['/api/bookslist'];
        //排除不需要校验的接口
        if(writePath.includes(ctx.path)){
            await next();
        }else{
            //请求头中获取egg-identity
            if(ctx.get('egg-identity') && ctx.get('egg-identity') === 'admin'){
                await next()
            }else{
                ctx.body = {
                    code:4,
                    msg:'无权限',
                    status:401
                }
            }
        }
    }
}